package net.microfigure.mapper;

import net.microfigure.model.FamilyInfo;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.mapper.BaseMapper;

/**
 * <p>
  *  Mapper 接口
 * </p>
 *
 * @author 林景锋
 * @since 2018-06-15
 */
@Mapper
public interface FamilyInfoMapper extends BaseMapper<FamilyInfo> {

	
//     List<FamilyInfo> selectByFamilyHousemaster(@Param("housemaster") String housemaster);

	String selectIdByFamilyHousemaster(@Param("housemaster") String housemaster);

	@Select("select family_info_no AS familyInfoNo,"
			+ "family_no AS familyNo,card_no AS cardNo,"
			+ "name,gender,age,address,contact,"
			+ "rela_type AS relaType,id,part_state AS partState,ill_card_no AS illCardNo "
			+ "from family_info where card_no = #{cardNo}")
	List<FamilyInfo> selectListByCardNo(String cardNo);

	
	@Select("select max(family_info_no) from family_info where family_no = #{familyNo}")
	Integer selectMaxfamilyInfoByfamilyNo(String familyNo);
	
	@Select("select family_info_no AS familyInfoNo,"
			+ "family_no AS familyNo,card_no AS cardNo,"
			+ "name,gender,age,address,contact,"
			+ "rela_type AS relaType,id,part_state AS partState,ill_card_no AS illCardNo "
			+ "from family_info where family_info_no = #{familyInfoNo}")
	FamilyInfo selectByFamilyInfoNo(Integer familyInfoNo);
}